#!/usr/bin/python 
#-*- coding=utf-8 -*-

import tornado.web
import tornado.ioloop
import os
import zc.zk

from handler.IndexHandler import IndexHandler

if __name__ == '__main__':
    zk = zc.zk.ZooKeeper('127.0.0.1:2181')
    settings = {
        'web-root': os.getcwd(),
        'static-path': os.path.join(os.path.dirname(__file__), 'static'),
        'zookeeper': zk
    }
    print settings
    app = tornado.web.Application([
            (r'/static/(.*)', tornado.web.StaticFileHandler, dict(path = settings['static-path'])),
            (r'/', IndexHandler, dict(root = settings['web-root'], zk = settings['zookeeper']))
          ])
    app.listen(8080)
    tornado.ioloop.IOLoop.instance().start()
